package com.ph.controller;

import com.ph.pojo.KeepPlan;
import com.ph.pojo.Result;
import com.ph.service.KeepPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("plan")
public class KeepPlanController {
    @Autowired
    private KeepPlanService keepPlanService;

    @GetMapping
    public Result<List<KeepPlan>> findAll() {
        return Result.success(keepPlanService.findAll());
    }

    @PostMapping
    public Result<Boolean> add(@RequestBody KeepPlan keepPlan){
        return Result.success(keepPlanService.save(keepPlan));
    }
}
